<%--
  Created by IntelliJ IDEA.
  User: 14587
  Date: 2020/11/10
  Time: 9:49
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>KKd的博客</title>
    <%--引入头文件--%>
    <%@include file="../common/head.jsp"%>
    <%--使用showdown接入markdown--%>
    <script type="text/javascript" src="${pageContext.request.contextPath}/showdown-1.9.1/dist/showdown.min.js"></script>
    <%--引入css--%>
    <link href="http://cdn.bootcss.com/highlight.js/8.0/styles/monokai_sublime.min.css" rel="stylesheet">
    <script src="http://cdn.bootcss.com/highlight.js/8.0/highlight.min.js"></script>
    <script >hljs.initHighlightingOnLoad();</script>
    <script type="text/javascript">
        $(function () {
            /*引入ajax*/
            <%@include file="../common/searchAjax.jsp"%>
            /*引入ajax*/
        })
        $(document).ready(function () {
            convert();
        })
        function convert() {
            var text = document.getElementById("oriContent").value;
            var converter = new showdown.Converter();
            var html = converter.makeHtml(text);
            document.getElementById("blogContentRes").innerHTML = html;
        }
        //点赞并且更新赞
        function thumb(id) {
            $.post({
                url:"${pageContext.request.contextPath}/blog/addThumbBlog",
                data:{"blogId":${blog.blogId}},
                success:function (data) {
                    $("#"+id).text("| 点赞："+data);
                }
            })
        }
        /*引入showCata.jsp*/
        <%@include file="../common/showCata.jsp"%>
    </script>
</head>
<body class="pic-bg">
<div class="container-fluid">
    <div class="row-fluid">
        <%--包含头部页面--%>
        <%@include file="../common/headPage.jsp"%>
        <%--包含头部页面--%>
    </div>
    <div class="row-fluid">
        <%--输出的主要页面信息--%>
        <div class="col-md-9 displayTextBg" style="border-top:5px solid #000000;border-left:5px solid; height:750px;overflow:auto">
            <c:if test="${blog!=null}">
                <div>
                        <%--输出博客信息--%>
                    <h2 style="color: #ffffff" class="text-center">
                            ${blog.title}
                    </h2>
                    <h4 style="color: #ffffff" class="text-right">|&nbsp;浏览量：${blog.viewCount}&nbsp;</h4>
                            <h4 style="color: #ffffff" class="text-right"id="thumbCount"><a id="thumb" style="color: white" href="javascript:void (0)" onclick="thumb(this.id)">|&nbsp;&nbsp;点赞:${blog.thumbCount}</a></h4>

                            <%--这里的getreferer不能行--%>

                    <%--<h3 style="color: #ffffff" class="text-right">
                            <a href="${requestScope.get("Referer")}" style="color: white">返回上一页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
                    </h3>--%>
                    <h3 class="text-right" style="color:white;">${blog.date}</h3>
                    <textarea rows="1" style="display:none" id="oriContent">${blog.comment}</textarea>
                    <div id="blogContentRes" style="color: #ffffff;height:700px;overflow:auto">
                        <%--这里是要输出的文本--%>
                    </div>
                   <%-- <script type="text/javascript">
                        function convert() {
                            var text = document.getElementById("oriContent").value;
                            console.log(text);
                            var converter = new showdown.Converter();
                            var html = converter.makeHtml(text);
                            document.getElementById("blogContentRes").innerHTML = html;
                        }
                    </script>--%>
                </div>
            </c:if>
            <c:if test="${blog=null}">
                <div>
                        <%--输出博客信息--%>
                    <h2 style="color: #ffffff" class="text-center">
                            您搜索的内容为空！
                    </h2>
                </div>
            </c:if>
        </div>
        <%--包含右侧页面信息--%>
            <%@include file="../common/rightPage.jsp"%>
        <%--包含右侧页面信息--%>
    </div>
</div>
</body>
</html>
